//
//  VipMemberItem.swift
//  todoios
//
//  Created by qianli on 2025/4/18.
//

import Foundation
import UIKit

class VipMemberItem: UIView {
    private var p8aIIyeOuXFRPU0D:UILabel?
    private var K2bCupCAyWrz2PNE:UILabel?
    private var grbYZriKwbkI7hAa:UILabel?
    
    deinit {
        QianliUniversalFunc.QianliLog("------VipMemberItem.deinit")
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
    }
    
    init(frame:CGRect,isSuper:Bool){
        super.init(frame: frame)
        self.GHL4Rhb91XYBer27(isSuper)
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func GHL4Rhb91XYBer27(_ isSuper:Bool){
        let highTextColor = UIColor.init(51, 102, 255)
//        let foreColor = isSuper ? UIColor(hexString: "#ff4949") : UIColor(hexString: "#3964ff")
        self.layer.borderColor = UIColor.systemGray.cgColor //foreColor.cgColor
        self.layer.borderWidth = 1 //0.5
        self.layer.cornerRadius = 12
        let selectBtnHeight = self.bounds.height//100.0
        let height_1 = selectBtnHeight*0.4
        let selectBtnWidth = self.bounds.width//(qianli_pm_width-30-60)/2
        self.p8aIIyeOuXFRPU0D = UILabel(frame: CGRect(x: 0, y: 0, width: selectBtnWidth, height: height_1))
        if let labelname = self.p8aIIyeOuXFRPU0D{
            self.addSubview(labelname)
            labelname.font = .boldSystemFont(ofSize: 14)
            labelname.textColor = .label // .secondaryLabel
            labelname.textAlignment = .center
            labelname.text = isSuper ? "高级-卡" : "普通-卡"
        }
        let height_2 = selectBtnHeight*0.3
        self.K2bCupCAyWrz2PNE = UILabel(frame: CGRect(x: 0, y: height_1, width: selectBtnWidth, height: height_2))
        if let labelPrice = self.K2bCupCAyWrz2PNE{
            self.addSubview(labelPrice)
            labelPrice.font = .boldSystemFont(ofSize: 18)
            labelPrice.textColor = highTextColor
            labelPrice.textAlignment = .center
            labelPrice.text = "￥--"
        }
        self.grbYZriKwbkI7hAa = UILabel(frame: CGRect(x: 0, y: selectBtnHeight-height_2, width: selectBtnWidth, height: height_2))
        if let labelDes = self.grbYZriKwbkI7hAa{
            self.addSubview(labelDes)
            labelDes.font = .systemFont(ofSize: 11)
            labelDes.textColor = highTextColor
            labelDes.textAlignment = .center
            labelDes.text = "---卡 ￥-.--元/天"
        }
    }
    
    func ElKjT0XoruF4uLja(title:String,price:String,averagePrice:String){
        if let labelname = self.p8aIIyeOuXFRPU0D{
            labelname.text = title
        }
        if let labelPrice = self.K2bCupCAyWrz2PNE{
            labelPrice.text =  "￥" + price
        }
        if let labelDes = self.grbYZriKwbkI7hAa{
            labelDes.text = averagePrice
        }
    }
    
    func axiY63tGy3zH5FZz()-> String{
        if let labelname = self.p8aIIyeOuXFRPU0D,let title = labelname.text{
           return title
        }
        return ""
    }
    
    func tSQvgMgiyIR3xjLy()->String{
        if let labelPrice = self.K2bCupCAyWrz2PNE,let price = labelPrice.text{
            return price.replacingOccurrences(of: "￥", with: "")
        }
        return ""
    }
    
    func DYybO9LYqGsn71sn(){
        self.layer.borderColor = UIColor.systemGray.cgColor
        if let labelPrice = self.K2bCupCAyWrz2PNE{
            labelPrice.textColor = .systemGray
        }
        if let labelDes = self.grbYZriKwbkI7hAa{
            labelDes.textColor = .systemGray
        }
    }
    
    func eR3jFv8zTE3isREs(bkcolor:UIColor){
        self.backgroundColor = bkcolor
    }
    
}
